<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>LCOV - ged.info - gil/virtual_locator.hpp</title>
  <link rel="stylesheet" type="text/css" href="../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LTP GCOV extension - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
        <tr>
          <td class="headerItem" width="20%">Current&nbsp;view:</td>
          <td class="headerValue" width="80%" colspan=4><a href="../index.html">directory</a> - <a href="index.html">gil</a> - virtual_locator.hpp</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Test:</td>
          <td class="headerValue" width="80%" colspan=4>ged.info</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Date:</td>
          <td class="headerValue" width="20%">2009-06-09</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Instrumented&nbsp;lines:</td>
          <td class="headerValue" width="20%">3</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Code&nbsp;covered:</td>
          <td class="headerValue" width="20%">100.0 %</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Executed&nbsp;lines:</td>
          <td class="headerValue" width="20%">3</td>
        </tr>
        </table>
      </td>
    </tr>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td><pre class="source">
<span class="lineNum">       1 </span>                : /*
<span class="lineNum">       2 </span>                :     Copyright 2005-2007 Adobe Systems Incorporated
<span class="lineNum">       3 </span>                :    
<span class="lineNum">       4 </span>                :     Use, modification and distribution are subject to the Boost Software License,
<span class="lineNum">       5 </span>                :     Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
<span class="lineNum">       6 </span>                :     http://www.boost.org/LICENSE_1_0.txt).
<span class="lineNum">       7 </span>                : 
<span class="lineNum">       8 </span>                :     See http://opensource.adobe.com/gil for most recent version including documentation.
<span class="lineNum">       9 </span>                : */
<span class="lineNum">      10 </span>                : 
<span class="lineNum">      11 </span>                : /*************************************************************************************************/
<span class="lineNum">      12 </span>                : 
<span class="lineNum">      13 </span>                : #ifndef GIL_VIRTUAL_LOCATOR_HPP
<span class="lineNum">      14 </span>                : #define GIL_VIRTUAL_LOCATOR_HPP
<span class="lineNum">      15 </span>                : 
<span class="lineNum">      16 </span>                : ////////////////////////////////////////////////////////////////////////////////////////
<span class="lineNum">      17 </span>                : /// \file               
<span class="lineNum">      18 </span>                : /// \brief Locator for virtual image views
<span class="lineNum">      19 </span>                : /// \author Lubomir Bourdev and Hailin Jin \n
<span class="lineNum">      20 </span>                : ///         Adobe Systems Incorporated
<span class="lineNum">      21 </span>                : /// \date   2005-2007 \n Last updated on February 12, 2007
<span class="lineNum">      22 </span>                : ///
<span class="lineNum">      23 </span>                : ////////////////////////////////////////////////////////////////////////////////////////
<span class="lineNum">      24 </span>                : 
<span class="lineNum">      25 </span>                : #include &lt;boost/iterator/iterator_facade.hpp&gt;
<span class="lineNum">      26 </span>                : #include &quot;position_iterator.hpp&quot;
<span class="lineNum">      27 </span>                : 
<span class="lineNum">      28 </span>                : namespace boost { namespace gil {
<span class="lineNum">      29 </span>                : 
<span class="lineNum">      30 </span>                : /// \brief A 2D locator over a virtual image. Upon dereferencing, invokes a given function object passing it its coordinates. Models: PixelLocatorConcept, HasDynamicXStepTypeConcept, HasDynamicYStepTypeConcept, HasTransposedTypeConcept
<span class="lineNum">      31 </span>                : /// \ingroup PixelLocatorModel PixelBasedModel
<span class="lineNum">      32 </span>                : /// 
<span class="lineNum">      33 </span>                : template &lt;typename Deref, bool IsTransposed&gt;        // A function object that given a point returns a reference. Models PixelDereferenceAdaptorConcept
<span class="lineNum">      34 </span><span class="lineCov">              5 : class virtual_2d_locator : public pixel_2d_locator_base&lt;virtual_2d_locator&lt;Deref,IsTransposed&gt;, position_iterator&lt;Deref,IsTransposed&gt;, position_iterator&lt;Deref,1-IsTransposed&gt; &gt; {</span>
<span class="lineNum">      35 </span>                :     typedef virtual_2d_locator&lt;Deref,IsTransposed&gt;  this_t;
<span class="lineNum">      36 </span>                : public:
<span class="lineNum">      37 </span>                :     typedef pixel_2d_locator_base&lt;virtual_2d_locator&lt;Deref,IsTransposed&gt;, position_iterator&lt;Deref,IsTransposed&gt;, position_iterator&lt;Deref,1-IsTransposed&gt; &gt; parent_t;
<span class="lineNum">      38 </span>                :     typedef virtual_2d_locator&lt;typename Deref::const_t,IsTransposed&gt;        const_t;
<span class="lineNum">      39 </span>                : 
<span class="lineNum">      40 </span>                :     typedef Deref                                  deref_fn_t;
<span class="lineNum">      41 </span>                :     typedef typename parent_t::point_t             point_t;
<span class="lineNum">      42 </span>                : 
<span class="lineNum">      43 </span>                :     typedef typename parent_t::coord_t             coord_t;
<span class="lineNum">      44 </span>                :     typedef typename parent_t::x_coord_t           x_coord_t;
<span class="lineNum">      45 </span>                :     typedef typename parent_t::y_coord_t           y_coord_t;
<span class="lineNum">      46 </span>                :     typedef typename parent_t::x_iterator          x_iterator;
<span class="lineNum">      47 </span>                :     typedef typename parent_t::y_iterator          y_iterator;
<span class="lineNum">      48 </span>                : 
<span class="lineNum">      49 </span>                :     template &lt;typename NewDeref&gt; struct add_deref {
<span class="lineNum">      50 </span>                :         typedef virtual_2d_locator&lt;deref_compose&lt;NewDeref,Deref&gt;,IsTransposed &gt; type;
<span class="lineNum">      51 </span>                :         static type make(const virtual_2d_locator&lt;Deref,IsTransposed&gt;&amp; loc, const NewDeref&amp; nderef) { 
<span class="lineNum">      52 </span>                :             return type(loc.pos(), loc.step(), deref_compose&lt;NewDeref,Deref&gt;(nderef,loc.deref_fn())); 
<span class="lineNum">      53 </span>                :         }
<span class="lineNum">      54 </span>                :     };
<span class="lineNum">      55 </span>                : 
<span class="lineNum">      56 </span><span class="lineCov">              4 :     virtual_2d_locator(const point_t&amp; p=point_t(0,0), const point_t&amp; step=point_t(1,1), const deref_fn_t&amp; d=deref_fn_t()) : _p(p,step,d) {}</span>
<span class="lineNum">      57 </span>                :     template &lt;typename D, bool TR&gt; virtual_2d_locator(const virtual_2d_locator&lt;D,TR&gt;&amp; loc, coord_t y_step)
<span class="lineNum">      58 </span>                :         : _p(loc.pos(), point_t(loc.step().x,loc.step().y*y_step),     loc.deref_fn()) {}
<span class="lineNum">      59 </span>                :     template &lt;typename D, bool TR&gt; virtual_2d_locator(const virtual_2d_locator&lt;D,TR&gt;&amp; loc, coord_t x_step, coord_t y_step, bool transpose=false)
<span class="lineNum">      60 </span>                :         : _p(loc.pos(), transpose ? 
<span class="lineNum">      61 </span>                :                     point_t(loc.step().x*y_step,loc.step().y*x_step) : 
<span class="lineNum">      62 </span>                :                     point_t(loc.step().x*x_step,loc.step().y*y_step), loc.deref_fn()) { assert(transpose==(IsTransposed!=TR));}
<span class="lineNum">      63 </span>                : 
<span class="lineNum">      64 </span>                :     template &lt;typename D, bool TR&gt; virtual_2d_locator(const virtual_2d_locator&lt;D,TR&gt;&amp; pl) : _p(pl._p) {}
<span class="lineNum">      65 </span><span class="lineCov">              4 :     virtual_2d_locator(const virtual_2d_locator&amp; pl) : _p(pl._p) {}</span>
<span class="lineNum">      66 </span>                : 
<span class="lineNum">      67 </span>                :     bool              operator==(const this_t&amp; p) const { return _p==p._p; }
<span class="lineNum">      68 </span>                : 
<span class="lineNum">      69 </span>                :     x_iterator&amp;       x()                               { return *gil_reinterpret_cast&lt;x_iterator*&gt;(this); }
<span class="lineNum">      70 </span>                :     y_iterator&amp;       y()                               { return _p; }
<span class="lineNum">      71 </span>                :     x_iterator const&amp; x()                         const { return *gil_reinterpret_cast_c&lt;x_iterator const*&gt;(this); }
<span class="lineNum">      72 </span>                :     y_iterator const&amp; y()                         const { return _p; }
<span class="lineNum">      73 </span>                : 
<span class="lineNum">      74 </span>                :     // Returns the y distance between two x_iterators given the difference of their x positions
<span class="lineNum">      75 </span>                :     y_coord_t y_distance_to(const this_t&amp; it2, x_coord_t xDiff) const { return (it2.pos()[1-IsTransposed] - pos()[1-IsTransposed])/step()[1-IsTransposed]; }
<span class="lineNum">      76 </span>                :     bool      is_1d_traversable(x_coord_t)        const { return false; }   // is there no gap at the end of each row? I.e. can we use x_iterator to visit every pixel instead of nested loops?
<span class="lineNum">      77 </span>                : 
<span class="lineNum">      78 </span>                :     // Methods specific for virtual 2D locator
<span class="lineNum">      79 </span>                :     const point_t&amp;   pos()                        const { return _p.pos(); }
<span class="lineNum">      80 </span>                :     const point_t&amp;   step()                       const { return _p.step(); }
<span class="lineNum">      81 </span>                :     const deref_fn_t&amp; deref_fn()                  const { return _p.deref_fn(); }
<span class="lineNum">      82 </span>                : private:
<span class="lineNum">      83 </span>                :     template &lt;typename D, bool TR&gt; friend class virtual_2d_locator;
<span class="lineNum">      84 </span>                :     y_iterator        _p;    // contains the current position, the step and the dereference object
<span class="lineNum">      85 </span>                : };
<span class="lineNum">      86 </span>                : 
<span class="lineNum">      87 </span>                : /////////////////////////////
<span class="lineNum">      88 </span>                : //  PixelBasedConcept
<span class="lineNum">      89 </span>                : /////////////////////////////
<span class="lineNum">      90 </span>                : 
<span class="lineNum">      91 </span>                : template &lt;typename D, bool TR&gt;
<span class="lineNum">      92 </span>                : struct channel_type&lt;virtual_2d_locator&lt;D,TR&gt; &gt; : public channel_type&lt;typename virtual_2d_locator&lt;D,TR&gt;::parent_t&gt; {
<span class="lineNum">      93 </span>                : };
<span class="lineNum">      94 </span>                : 
<span class="lineNum">      95 </span>                : template &lt;typename D, bool TR&gt;
<span class="lineNum">      96 </span>                : struct color_space_type&lt;virtual_2d_locator&lt;D,TR&gt; &gt; : public color_space_type&lt;typename virtual_2d_locator&lt;D,TR&gt;::parent_t&gt; {
<span class="lineNum">      97 </span>                : };
<span class="lineNum">      98 </span>                : 
<span class="lineNum">      99 </span>                : template &lt;typename D, bool TR&gt;
<span class="lineNum">     100 </span>                : struct channel_mapping_type&lt;virtual_2d_locator&lt;D,TR&gt; &gt; : public channel_mapping_type&lt;typename virtual_2d_locator&lt;D,TR&gt;::parent_t&gt; {
<span class="lineNum">     101 </span>                : };
<span class="lineNum">     102 </span>                : 
<span class="lineNum">     103 </span>                : template &lt;typename D, bool TR&gt;
<span class="lineNum">     104 </span>                : struct is_planar&lt;virtual_2d_locator&lt;D,TR&gt; &gt; : public is_planar&lt;typename virtual_2d_locator&lt;D,TR&gt;::parent_t&gt; {
<span class="lineNum">     105 </span>                : };
<span class="lineNum">     106 </span>                : 
<span class="lineNum">     107 </span>                : /////////////////////////////
<span class="lineNum">     108 </span>                : //  HasDynamicXStepTypeConcept
<span class="lineNum">     109 </span>                : /////////////////////////////
<span class="lineNum">     110 </span>                : 
<span class="lineNum">     111 </span>                : template &lt;typename D, bool TR&gt;
<span class="lineNum">     112 </span>                : struct dynamic_x_step_type&lt;virtual_2d_locator&lt;D,TR&gt; &gt; {
<span class="lineNum">     113 </span>                :     typedef virtual_2d_locator&lt;D,TR&gt; type;
<span class="lineNum">     114 </span>                : };
<span class="lineNum">     115 </span>                : 
<span class="lineNum">     116 </span>                : /////////////////////////////
<span class="lineNum">     117 </span>                : //  HasDynamicYStepTypeConcept
<span class="lineNum">     118 </span>                : /////////////////////////////
<span class="lineNum">     119 </span>                : 
<span class="lineNum">     120 </span>                : template &lt;typename D, bool TR&gt;
<span class="lineNum">     121 </span>                : struct dynamic_y_step_type&lt;virtual_2d_locator&lt;D,TR&gt; &gt; {
<span class="lineNum">     122 </span>                :     typedef virtual_2d_locator&lt;D,TR&gt; type;
<span class="lineNum">     123 </span>                : };
<span class="lineNum">     124 </span>                : 
<span class="lineNum">     125 </span>                : /////////////////////////////
<span class="lineNum">     126 </span>                : //  HasTransposedTypeConcept
<span class="lineNum">     127 </span>                : /////////////////////////////
<span class="lineNum">     128 </span>                : 
<span class="lineNum">     129 </span>                : template &lt;typename D, bool IsTransposed&gt;
<span class="lineNum">     130 </span>                : struct transposed_type&lt;virtual_2d_locator&lt;D,IsTransposed&gt; &gt; {
<span class="lineNum">     131 </span>                :     typedef virtual_2d_locator&lt;D,1-IsTransposed&gt; type;
<span class="lineNum">     132 </span>                : };
<span class="lineNum">     133 </span>                : 
<span class="lineNum">     134 </span>                : } }  // namespace boost::gil
<span class="lineNum">     135 </span>                : 
<span class="lineNum">     136 </span>                : #endif
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
  <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
  <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LTP GCOV extension version 1.6</a></td></tr>
  </table>
  <br>

</body>
</html>
